package main

import (
	"fmt"
)

//future技术
//利用管道把调用函数和输入参数解耦
func main() {
	query := query{sqlChan: make(chan string, 1), result: make(chan interface{}, 1)}
	go executeQuery(query)
	//设置sql
	query.sqlChan <- "SELECT * FROM SYS_USER"
	//获取结果
	result := <-query.result
	fmt.Println(result)
}

type query struct {
	sqlChan chan string
	result  chan interface{}
}

func executeQuery(q query) {
	sql := <-q.sqlChan
	q.result <- sql + ":result"
}
